package com.dreamwhale.accelerator.manage;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dreamwhale.accelerator.entity.AlAgentRule;
import com.dreamwhale.accelerator.mapper.AlAgentRuleMapper;
import com.dreamwhale.accelerator.service.AlArticleSetService;
import com.dreamwhale.accelerator.service.AlUserService;
import com.github.pagehelper.PageHelper;
import com.dreamwhale.accelerator.entity.AlUser;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.dreamwhale.accelerator.common.templetJson;
import com.dreamwhale.accelerator.common.loadJsonPage;
import com.dreamwhale.accelerator.mapper.AlUserMapper;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@RequestMapping("/backstage")
public class UserManageController {


	@Resource
	private AlUserMapper alUserMapper;
	/**
	 * 查询所有用户
	 */
	@ResponseBody
	@RequestMapping(value="/selectALUsers",method = RequestMethod.POST)
	public templetJson selectGkUser(HttpServletRequest request, HttpServletResponse response, Integer page,
									Integer limit, AlUser alUser){

		try {
			templetJson tem = null;
			PageHelper.startPage(page, limit, true);
			QueryWrapper<AlUser> queryWrapper = new QueryWrapper<>();
			queryWrapper.eq("user_del",0);
			List<AlUser> list =alUserMapper.selectList(queryWrapper);
			PageInfo<AlUser> pages = new PageInfo<AlUser>(list);
			tem = loadJsonPage.loadJsonPage(pages);
			return tem;
		} catch (Exception e) {
			e.printStackTrace();
			return  null;
		}
	}
}